package com.xc.controller.agent;

import com.xc.common.ServerResponse;
import com.xc.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author mipha
 * @version 1.0
 * @date 2019/2/24 4:47 PM
 */
@Controller
@RequestMapping("/agent/user/")
@Slf4j
public class AgentUserController {

    @Autowired
    IUserService iUserService;

    /**
     *      代理下 用户列表
     * @param realName
     * @param phone
     * @param agentId
     * @param accountType
     * @param pageNum
     * @param pageSize
     * @param request
     * @return
     */
    @RequestMapping("list.do")
    @ResponseBody
    public ServerResponse list(@RequestParam(value = "realName",required = false) String realName
                               ,@RequestParam(value = "phone",required = false) String phone
                               ,@RequestParam(value = "agentId", required = false) Integer agentId
                               ,@RequestParam(value = "accountType", required = false) Integer accountType
                                ,@RequestParam(value = "pageNum", defaultValue = "1") int pageNum
                                ,@RequestParam(value = "pageSize", defaultValue = "12") int pageSize
                                , HttpServletRequest request){
        return iUserService.listByAgent(realName ,phone ,agentId ,accountType ,pageNum ,pageSize ,request);
    }



}
